# demo02_extend.py  继承
class Role:  # 父类/基类
    def __init__(self, name, weapon):
        self.name = name
        self.weapon = weapon
    def show_me(self):
        print(f"我是{self.name}用的是{self.weapon}")
class Warrior(Role):
    def gongji(self, who):
        print(f"我是{self.name}在和{who}进行肉搏")
class Mega(Role):
    def gongji(self, who):
        print(f"我是{self.name}在和{who}远程消耗")
if __name__ == '__main__':
    lb = Warrior("吕布","方天画戟") #调用Role类init方法
    lb.show_me()  # 调用Role类show_me方法
    lb.gongji("貂蝉")  # 调用Warrior类gongji方法
    zj = Mega("张角", "雷")
    zj.show_me()
    zj.gongji("张氏")